<?php
/** .-------------------------------------------------------------------
* |    Author: 熊伟洋 <chelious@foxmail.com>
* |    WeChat: hello_McGrady
* |    	   QQ: 434493420
* |     Motto: Hungry & Humble
* |---------------------------------------------------------------------
* |    Copyright (c) 2012-2020, www.chelious.com. All Rights Reserved.
* '-------------------------------------------------------------------*/

namespace app\home\controller;

class Content extends Common {
    //动作
    public function index(){
        $aid = Q('get.aid');
//        p($aid);
        //点击进来之后click+1
        Db::table('article')->where('aid',$aid)->increment('click',1);
        $data = Db::table('article')
                ->join('article_data','article_data.article_aid','=',$aid)
                ->where('aid',$aid)
                ->first();
//        p($data);
        //获取标签的数据
        $data['tag'] = Db::table('article_tag')
                        ->join('tag','article_tag.tag_tid','=','tag.tid')
                        ->where('article_aid',$aid)
                        ->field(['tid','tname'])
                        ->get();
//        p($data);

        View::with('data',$data);

        return view();
    }
}
